define(['../../../../../js/lib/other/sweet-alert'],function() {
    return ['$scope','$location', '$interval','$timeout','$routeParams','bizProxy', function($scope,$location,$interval,$timeout,$routeParams,bizProxy) {
		$scope.$emit("top-show",'true');//顶部显示
    	$scope.$emit('menuTypeLight','mine'); 	//控制底部menu高亮
    	$scope.$emit('bub-menu','true'); 	//隐藏底部menu
    	$scope.$emit('flag-tag','28');//显示底部文字
    	
    	if($routeParams.flag != "" && $routeParams.flag != null){
    		getRepayDetail($routeParams.flag);
    	}
    	
    	var mobileNo;
    	
    	//点击打电话
    	$scope.callPhone = function(){
    		if(mobileNo != ""){
    			callPhone.callPhone(mobileNo,function(ret){
        			
        		},null);
    		}
    	}

    	//调用代理接口获取数据
    	function getRepayDetail(flag){
    		var headerInfo = {},bizInfo = {};
        	headerInfo.pageNum = '';
        	headerInfo.pageSize = '';
        	headerInfo.sessionId = transData.sessionId;
        	
        	bizInfo.loanApplyId = flag;
    		$scope.$emit("loadingChangeNav",true);
    		bizProxy.queryProxyBizData("queryRepayRecord",headerInfo,bizInfo,
    				function(tempData){//SUCCESS
		    			if(tempData.body != "" && tempData.body != null && tempData.body != "[]"){
							$timeout(function(){
								$scope.$emit("loadingChangeNav",false);
								var myRepayData = JSON.parse(tempData.body);
								$scope.repayData = myRepayData;
								mobileNo = myRepayData.mobileNo;
								var repayDetailData = myRepayData.repayDetailList;
								if(repayDetailData != "" && repayDetailData != null && repayDetailData != '[]'){
									$scope.repayDetailList = repayDetailData;
								}else{
									$scope.repayDetailList = "";
								}
							},0);
						}else{
							$scope.$emit("loadingChangeNav",false);
							$scope.$emit("promptAlertMsg","未查找到相关数据");
							$scope.$emit("showCollect",true);
							$timeout(function(){
								$scope.$emit("showCollect",false);
								history.back();
							},transData.promptTime);
						}
		    		},function(data){
		    			if(data != ""){//FAIL
		    				$scope.$emit("loadingChangeNav",false);
							if(data.errorCode == ERROR_CODE.noLogin){
								FIREFLY("", data.errorMsg,"",function(){
										//调用退出登录
										transData.mobileNo = "";
		    							transData.password = "";
		    							transData.sessionId = "";
		    							transData.userType = "";
		    							resultData.loginUserData = "";
		    							$timeout(function(){
		    								$scope.$emit("goNext","/mine");
		    							},0);
								});
							}else{
								$scope.$emit("promptAlertMsg",data.errorMsg);
								$scope.$emit("showCollect",true);
								$timeout(function(){
									$scope.$emit("showCollect",false);
									history.back();
								},transData.promptTime);
							}
		    			}else{
		    				$scope.$emit('loadingChangeNav', false);
		    				$scope.$emit("promptAlertMsg","连接超时");
		    				$scope.$emit("showCollect",true);
		    				$timeout(function(){
		    					$scope.$emit("showCollect",false);
		    					history.back();
		    				},transData.promptTime);
		    			}
		    		});
    	}
    	
    	
        $scope.$apply();
    }];
});